/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-03-13
 * Time: 21:44
 */
public class Reserve {
    //翻转数组
    public static void main(String[] args) {
        int [] arr = {1,2,3,4,5};
        int [] ret =reserve(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(ret[i]);
        }
    }
    public static int [] reserve( int [] arr){
        int [] ret = new int[ arr.length ];
        for (int i = 0, j= arr.length - 1; i <arr.length; i++,j--) {
            ret[j] = arr[i];
        }
        return ret;
    }
}
